package com.itheima.lamabd2diy;

import org.junit.Test;

/**
 * @Author: Ethan Yankang
 * @Program: JAVA核心技术
 * @Date: 2024-08-10 15:26
 **/
public class MyFuncImplTest {
public String handerStringByDiyLamabd(MyFunc<String> myFunc,String str){
    return myFunc.getValue(str);
  }
  @Test
  public void testDiyLamabd(){
    String originStr="zhengyangkang";
      System.out.println("原字符串为：");
      System.out.println("originStr = " + originStr);
      System.out.println("使用自制的lamabd表达式来实现字符串操作");
      System.out.println("字符串转大写");
      String strNameToUpperCase = handerStringByDiyLamabd((s) -> s.toUpperCase(), originStr);
//      System.out.println(strNameToUpperCase);
      System.out.println("strNameToUpperCase = " + strNameToUpperCase);
      System.out.println("字符串截取");
      String strNameSubString=handerStringByDiyLamabd(s->s.substring(4),originStr);
//      System.out.println(strNameSubString);
      System.out.println("strNameSubString = " + strNameSubString);
  }
}
